<template>
	<view class="article">
		<template v-if="arctileObj">
			<view class="article-con">
				<view class="title">{{arctileObj.title}}</view>
				<view class="uni-flex list-info">
					<view class="date">
						<uni-icons type="calendar" size="12" color="#9498A0"></uni-icons>
						<text>{{arctileObj.publishTime}}</text>
					</view>
					<view class="see">
						<uni-icons type="eye" color="#9498A0" size="14"></uni-icons>
						<text>{{arctileObj.browseNum}}</text>
					</view>
				</view>
			</view>
			<view class="summary" v-if="arctileObj.resume">
				<view class="title"><uni-icons type="calendar-filled" color="#00B5DD" size="16"></uni-icons><text
						style="margin-left: 15rpx;">摘要</text></view>
				<text class="con">{{arctileObj.resume}}</text>
			</view>
			<view class="art">
				<rich-text :nodes="nodes"></rich-text>
				
			</view>
		</template>
		<view class="uni-loadmore" v-if="showLoadMore">加载中...</view>
	</view>
</template>

<script>
	import {
		appDetailNewsInfo
	} from "@/api/user.js";
	export default {
		data() {
			return {
				parmas: '',
				arctileObj: null,
				showLoadMore: false,
				nodes: [],
			}
		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			console.log(option.id); //打印出上个页面传递的参数。
			this.parmas = option.id;
			this.showLoadMore = true;
			//console.log("onload", this.arctileObj)
			this.appDetailNewsInfo(this.parmas);
		},
		onPullDownRefresh(){
			this.showLoadMore = true;
			this.appDetailNewsInfo(this.parmas);
			uni.stopPullDownRefresh();
		},
		methods: {
			async appDetailNewsInfo(options) {
				const res = await appDetailNewsInfo(options);
				console.log(res)
				this.arctileObj = res.returnObj;
				this.nodes = this.arctileObj.content;
				console.log("nodes", this.arctileObj.content)
				this.showLoadMore = false;
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-image: url("https://staticfile-yj.obs.myhuaweicloud.com/course-bg.png");
		background-repeat: no-repeat;
		background-size: 100% auto;
		background-color: #fff;
	}

	.article {
		padding: 30rpx;
	}

	.title {
		color: #283241;
		font-size: 40rpx;
		font-weight: 500;
		line-height: 28px;
	}

	.summary {
		background-color: #F5F8FB;
		border-radius: 8px;
		padding: 24rpx 32rpx;
		margin: 30px 0;
	}

	.summary .title {
		font-size: 36rpx;
		line-height: 26px;
		color: #283241;
		flex-flow: row nowrap;
		justify-content: flex-start;
		align-items: center;
	}

	.summary .con {
		line-height: 26px;
		font-size: 28rpx;
		font-weight: 400;
		color: #283241;
	}

	.art text {
		font-size: 28rpx;
		line-height: 26px;
	}

	.art image {
		max-width: 90%;
		margin: 15px auto;
		display: block;
	}
</style>